/**
 * 项目名称:
 *
 * @Author: 夏国倩
 * @Date: 2023/10/9 16:34
 * @Copyright
 */
package IO;
import java.io.File;
import java.io.IOException;

public class FileTest6 {
    public static void main(String[] args) {
        String pathname="D:/myDoc/test.txt";
        File file=new File(pathname);
        System.out.println(file);

        try{
            File file1=new File("d:\\test.txt");
            //创建文件
            boolean b=file1.createNewFile();
            System.out.println("b="+b);

            //删除文件
            boolean b1=file1.delete();
            System.out.println("b1="+b1);

            //判断文件是否存在
            boolean b2 = file1.exists();
            System.out.println("b2="+b2);

        }catch (IOException e){
            throw new RuntimeException();
        }
    }
}
